<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>Title</title>
	</head>
	<body>
		<!-- 非父子结构生成树结构 -->
		<!-- 
		     private Long id;
		     private String pid;
		     private String ename;
		     private String name;
		     private String pattern;
		     private Integer type;
		     private Integer morder;
		     private Integer status;
		     private List<Role> roles;
		 -->
		<!-- 循环展示根层级目录 -->
		<div th:fragment="menuTree(menus)">
			<th:block th:each="menu : ${menus}">
				<th:block th:if="${menu.type}==0 and ${menu.pid==0}"
					th:include="@{/basic/menu}::menuTreeGloup(menus=${menus},menu=${menu},id=${menu.id})"></th:block>
				<th:block th:if="${menu.type}==1 and ${menu.pid==0}">
					<li class="layui-nav-item"><a href="#" th:onclick="changePage([[${menu.pattern}]])" th:text="${menu.name}"></a></li>
				</th:block>
			</th:block>
		</div>
		<!-- 显示菜单组 -->
		<div th:fragment="menuTreeGloup(menus,menu,id)">
			<li class="layui-nav-item">
				<a href="javascript:;" th:text="${menu.name}"></a>
				<dl class="layui-nav-child">
					<th:block th:include="@{/basic/menu}::menuTreeItem(menus=${menus},pid=${id})"></th:block>
				</dl>
			</li>
		</div>
		<!-- 显示菜单节点 -->
		<div th:fragment="menuTreeItem(menus,pid)">
			<th:block th:each="menuItem : ${menus}">
				<dd th:if="${menuItem.pid}==${pid} and ${menuItem.type}==1">
					<a href="#" th:onclick="changePage([[${menuItem.pattern}]])"  th:text="${menuItem.name}">模块</a>
				</dd>
				<th:block th:if="${menuItem.pid}==${pid} and ${menuItem.type}==0"
					th:include="@{/basic/menu}::menuTreeGloup(menus=${menus},menu=${menuItem},id=${menuItem.id})">
				</th:block>
			</th:block>
		</div>
	</body>
</html>
